package cn.edu.zafu.bigdata.override;
public class MathOperations {

    // 方法重载：两个整数的和
   static public int add(int a, int b) {
        return a + b;
    }

    // 方法重载：两个浮点数的和
    static double add(double a, double b) {
        return a + b;
    }

    // 方法重载：三个整数的和
    static int add(int a, int b, int c) {
        return a + b + c;
    }

    // 测试类
    public static class TestMathOperations {
        public static void main(String[] args) {
            MathOperations mathOps = new MathOperations();

            // 调用 add(int, int)
            int sum1 = mathOps.add(5, 3);
            System.out.println("Sum of two integers: " + sum1);

            // 调用 add(double, double)
            double sum2 = mathOps.add(2.5, 3.5);
            System.out.println("Sum of two doubles: " + sum2);

            // 调用 add(int, int, int)
            int sum3 = mathOps.add(1, 2, 3);
            System.out.println("Sum of three integers: " + sum3);
        }
    }
}

